﻿using System;
using System.Collections;
using System.Collections.Generic;
using COC.Algorithm;
using COC.Character;
using COC.Character.Extra;
using UnityEngine;
namespace COC.Tools.Pathing.Test
{
    public class GenerateDynamicalObject : BaseBehaviourSupport
    {
        Component dynamicObj;
        PoolManager<String, Component> singleObjectPool;
        private float tileSize = 10.0f;
        Vector3 mousePos;

        public override void OnStart()
        {
            singleObjectPool = ObjectPool.getInstance();


        }
        void FixedUpdate()
        {

            if (Input.GetMouseButtonUp(0))
            {
                //Ray ray = currCamera.ScreenPointToRay(mousePos);
                mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
                UnityEngine.Debug.Log("[POSITION]:Mouse Position 【"+mousePos.x+","+mousePos.y+","+mousePos.z+"].");
                dynamicObj = singleObjectPool.Spawn(Characters.ARCHER, mousePos);
                dynamicObj.transform.parent = this.transform;
                dynamicObj.transform.localPosition=new Vector3(dynamicObj.transform.localPosition.x,0.06f,dynamicObj.transform.localPosition.z);
                dynamicObj.transform.localScale = new Vector3(tileSize, .4f, tileSize);

            }
        }

        void Destroy()
        {

        }
    }
}
